<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
	arr1 = [1, 2, 2, 4, 4, 7];
	arr2 = [];
	
	function removeDuplicates(arr){
		let newArr = [];
		arr.forEach((self, index, arr) => {
			arr.indexOf(self) === index ? newArr.push(self) : null;
		});
		return newArr;
	}
	
	console.log(arr1);
	
	arr2 = removeDuplicates(arr1);
	
	console.log(arr2);

</script>

</body>
</html>